<template>
  <div class="header">
    <div class="header-nav">
      <div>
        <i class="icon_search iconfont"> &#xe650; </i>
      </div>
      <div class="header_sea">
        <i class="iconfont search_pic">&#xe613;</i>
        <input
          type="search"
          class="inputSearch"
          placeholder="请输入城市/景点/旅游主题"
        />
      </div>
      <div class="header_right">
        <span @click="toCity"
          >{{ cityName }}<i class="heade_r_smapic"></i
        ></span>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  methods: {
    toCity() {
      this.$router.push('/city')
    }
  },
  computed: {
    ...mapState(['cityName'])
  }
}
</script>

<style lang="less" scoped>
.header-nav {
  height: 0.9rem;
  position: relative;
  width: 100%;
  background-color: #00bcd4;
  display: flex;
  align-items: center;
  .icon_search {
    display: block;
    height: 0.7rem;
    width: 0.6rem;
    line-height: 0.7rem;
    text-align: center;
    font-size: 0.4rem;
    padding-right: 0.1rem;
  }
  color: white;
  .header_right {
    position: relative;
    right: 0.1rem;
    font-weight: 550;
    font-size: 0.3rem;
    height: 0.7rem;
    width: 0.9rem;
    line-height: 0.7rem;
    text-align: center;
    padding-left: 0.2rem;
    color: white;

    span {
      display: inline-block;
      .heade_r_smapic {
        display: inline-block;
        width: 0;
        height: 0;
        border: 0.1rem solid transparent; //所有border都是透明的，
        border-top-color: white; //只有尖相对的方向border有颜色
        margin-left: 0.07rem;
        color: white;
        margin-top: 0.08rem;
        vertical-align: middle;
      }
    }
  }
  .header_sea {
    flex: 1;
    height: 0.7rem;
    width: 100%;
    background-color: white;
    border-radius: 0.4rem;
    overflow: hidden;
    .inputSearch {
      height: 0.7rem;
      width: 100%;
      border: 0;
      padding-left: 0.6rem;
      &::-webkit-input-placeholder {
        color: #cccccc;
      }
    }
    .search_pic {
      position: absolute;
      padding-left: 0.15rem;
      color: #cccccc;
      line-height: 0.7rem;
    }
  }
}
</style>
